package com.situ.mall.service.Impl;

import com.situ.mall.mapper.ShippingMapper;
import com.situ.mall.mapper.TmAreaMapper;
import com.situ.mall.mapper.TmCityMapper;
import com.situ.mall.mapper.TmProvinceMapper;
import com.situ.mall.pojo.entity.Shipping;
import com.situ.mall.pojo.entity.TmArea;
import com.situ.mall.pojo.entity.TmCity;
import com.situ.mall.pojo.entity.TmProvince;
import com.situ.mall.service.IShippingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ShippingServiceImpl implements IShippingService {
    @Autowired
    private ShippingMapper shippingMapper;
    @Autowired
    private TmProvinceMapper tmProvinceMapper;
    @Autowired
    private TmCityMapper tmCityMapper;
    @Autowired
    private TmAreaMapper tmAreaMapper;

    @Override
    public List<Shipping> ListByUerId(Integer userId) {
        return shippingMapper.ListByUerId(userId);
    }

    @Override
    public List<TmProvince> selectProvince() {
        return tmProvinceMapper.selectProvince();
    }

    @Override
    public List<TmCity> selectCity(Integer provinceId) {
        return tmCityMapper.selectCity(provinceId);
    }

    @Override
    public List<TmArea> selectArea(Integer cityId) {
        return tmAreaMapper.selectArea(cityId);
    }

    @Override
    public String selectProvinceName(Integer provinceId) {
        return tmProvinceMapper.selectProvinceName(provinceId);
    }

    @Override
    public String selectCityName(Integer cityId) {
        return tmCityMapper.selectCityName(cityId);
    }

    @Override
    public String selectAreaName(Integer areaId) {
        return tmAreaMapper.selectAreaName(areaId);
    }

    @Override
    public void updateCheckedAll(Integer userId) {
        shippingMapper.updateCheckedAll(userId);
    }

    @Override
    public void add(Shipping shipping) {
        shippingMapper.insertSelective(shipping);
    }



    @Override
    public void updateDefault(Shipping shipping) {
        shippingMapper.updateByPrimaryKeySelective(shipping);
    }

    @Override
    public Shipping selectById(Integer id) {
        return shippingMapper.selectByPrimaryKey(id);
    }

    @Override
    public void update(Shipping shipping) {
        shippingMapper.updateByPrimaryKeySelective(shipping);
    }

    @Override
    public Shipping shippingById(Integer shippingId) {
        return shippingMapper.selectByPrimaryKey(shippingId);
    }

    @Override
    public Shipping ShippingByOrderNo(Long orderNo) {
        return shippingMapper.ShippingByOrderNo(orderNo);
    }

    @Override
    public void delete(Shipping shipping) {
        shippingMapper.updateByPrimaryKeySelective(shipping);
    }


}
